package com.example.shysx11.service;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.example.shysx11.dao.SuperVisorDao;
import com.example.shysx11.pojo.SuperVisor;
import com.example.shysx11.vos.ResultVo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class SuperVisorServiceImpl implements ISupervisorService {

    @Autowired
    private SuperVisorDao dao;

    @Override
    public  ResultVo getSupervisors(){
        List<SuperVisor> superVisors=dao.selectList(null);
        return  ResultVo.success("success get message",superVisors);

    }


    public  ResultVo getOne(String telId,String password){

        QueryWrapper<SuperVisor> qw=new QueryWrapper<>();
        qw.eq("tel_id", telId)
                .eq("password", password);
        SuperVisor superVisor=dao.selectOne(qw);

        if (superVisor == null) {
            return ResultVo.error("用户信息有误，不能登录");
        }
        return ResultVo.success("one success",superVisor);

    }
    }
